package com.qls.ali.model.dto.hotel.request;

import com.alibaba.fastjson.annotation.JSONField;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author doyoung
 */
public class PushHotel implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 外部酒店ID, 这是卖家自己系统中的ID
     */
    @JSONField(name = "outer_id")
    private String hotelCode;

    /**
     * 酒店名称,国内酒店请传中文名称
     */
    @JSONField(name = "name")
    private String hotelName;

    /**
     * 城市编码
     */
    private Integer city;

    /**
     * 酒店状态 0正常 -1删除 -2停售
     */
    private Integer status;

    /**
     * 酒店地址
     */
    private String address;

    /**
     * 酒店电话
     */
    @JSONField(name = "tel")
    private String phone;

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getHotelCode() {
        return hotelCode;
    }

    public void setHotelCode(String hotelCode) {
        this.hotelCode = hotelCode;
    }

    public String getHotelName() {
        return hotelName;
    }

    public void setHotelName(String hotelName) {
        if (hotelName.length() > 128) {
            hotelName = hotelName.substring(0, 128);
        }
        this.hotelName = hotelName;
    }

    public Integer getCity() {
        return city;
    }

    public void setCity(Integer city) {
        this.city = city;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        if (address.length() > 255) {
            address = address.substring(0, 255);
        }
        this.address = address;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        if (Objects.isNull(phone)) {
            phone = "";
        }
        String[] array = phone.split("/");
        phone = array[0];
        if (phone.length() > 30) {
            phone = phone.substring(0, 30);
        }
        this.phone = phone;
    }

    @Override
    public String toString() {
        return "PushHotel{" +
                "hotelCode='" + hotelCode + '\'' +
                ", hotelName='" + hotelName + '\'' +
                ", city=" + city +
                ", address='" + address + '\'' +
                ", phone='" + phone + '\'' +
                '}';
    }
}
